package tpoo.common.dto.model;

import java.io.Serializable;

import org.apache.commons.lang.builder.HashCodeBuilder;

public class ObjectID implements Serializable {

	private static final long serialVersionUID = 1L;
	private Serializable id;

	public ObjectID(Serializable id) {
		this.setId(id);
	}

	private void setId(Serializable id) {
		this.id = id;
	}

	public Serializable getId() {
		return id;
	}

	@Override
	public String toString() {
		return this.getId().toString();
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof ObjectID)
			return ((ObjectID) obj).getId().equals(this.getId());
		else
			return this.getId().equals(obj);
	}

	public int hashCode() {
		return HashCodeBuilder.reflectionHashCode(this);
	}

}
